package com.class05.condition;


import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class DogCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        // 假设我们从环境变量中获取一个属性来决定是否装配Dog
        return context.getEnvironment().getProperty("pet.type").equals("dog");
    }
}

